#@head() 
#@header()
<title>融资需求管理</title>
#@aside("target")

<link href="#(path)/assets/plugins/umeditor1.2.3-utf8-jsp/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="#(path)/assets/plugins/umeditor1.2.3-utf8-jsp/third-party/template.min.js"></script>
<script type="text/javascript" charset="utf-8" src="#(path)/assets/plugins/umeditor1.2.3-utf8-jsp/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="#(path)/assets/plugins/umeditor1.2.3-utf8-jsp/umeditor.min.js"></script>
<script type="text/javascript" src="#(path)/assets/plugins/umeditor1.2.3-utf8-jsp/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="#(path)/assets/js/jquery.tmpl.min.js"></script>
<div class="content-wrapper">
	<section class="content">
		<div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
              <li class=""><a href="#(path)/admin/page/target-financing" >发布融资需求</a></li>
              <!--<li class=""><a href="#(path)/admin/page/target-draft">草稿箱</a></li>-->
              <li id="tab3" class="active"><a href="#(path)/admin/page/target-requireaudit" >融资需求审核</a></li>
              <li id="tab4" class=""><a href="#(path)/admin/page/target-findingsaudit" >融资审核结果</a></li>
              <!--<li class=""><a href="#(path)/admin/page/target-transaction" >交易下线</a></li>-->
              <!--<li class=""><a href="#(path)/admin/page/target-transactioned" >已下线需求</a></li>-->
            </ul>
            <div class="tab-content">
              <!-- 融资需求审核 -->
              <div class="tab-pane active" id="tab_3">
				<!--<button type="button" onclick="window.location.href='#(path)/admin/page/target-financing'"  class="btn btn-block btn-info" style="width:120px;float:left;margin-top:10px;margin-right:20px;">发布融资需求</button>
				<label style="float:left;margin-top:17px;margin-left:20px;">时间区间:</label>
				<input type="text" class="form-control" onClick="WdatePicker()" style="width:120px;float:left;margin-top:10px;margin-left:10px;">
				<span style="float:left;margin:15px 5px 0 5px;">——</span>
				<input type="text" class="form-control" onClick="WdatePicker()" style="width:120px;float:left;margin-top:10px;margin-right:20px;">
				<div class="input-group margin" style="width:400px;float:left">
					<input type="text" class="form-control" >
					<span class="input-group-btn">
					  <button type="button" class="btn btn-info btn-flat">搜索</button>
					</span>
				</div>-->
				<div class="box-body">
					<table id="example1" class="table table-striped">
						<thead>
							<tr>
								<th>申请号(名称)</th>
								<th>申请时间</th>
								<th>融资金额(元)</th>
								<th>发布审核状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody id="shenhelist">
							
						</tbody>
					</table>
				</div>
				<div class="box-footer clearfix">
				  <ul class="pagination pagination-sm no-margin pull-right">
					<li id = "daish1"><a href="#">首页</a></li>
					<li id = "daish2"><a href="#">上一页</a></li>
					<li><a href="#">第<span id="daish5"></span>页 共<span id="daish6"></span>页</a></li>
					<li id = "daish3"><a href="#">下一页</a></li>
					<li id = "daish4"><a href="#">尾页</a></li>
				  </ul>
				</div>
              </div>
            <!-- /.tab-content -->
          </div>
		  
	</section>
</div>
#@footer()
<script id="shenhe" type="text/x-jquery-tmpl">
	<tr>
		<td>${name}</td>
		<td>${create_time}</td>
		<td>${amount}</td>
		<td><span class="badge bg-red">待审核</span></td>
		<td>
			<div class="btn-group">
			  <button onclick="location.href='#(path)/admin/page/target-details?id=${id}'" type="button" class="btn btn-info">查看</button>
			  <button pass="${id}" type="button" class="btn btn-success pass">通过</button>	  
			</div>
		</td>
	</tr>
</script>
<script>
var totalPage = 1;
var pageNumber = 1;
 $(document).ready(function(){
	totalPage = 1;
	pageNumber = 1;
	$("#shenhelist").empty();
	daish(1);
	$("#daish5").html(pageNumber);
});

$("#daish1").click(function(){
	$("#shenhelist").empty();
	daish(1);
	pageNumber = 1;
	$("#daish5").html(pageNumber);
});
$("#daish2").click(function(){
	if(pageNumber==1){
		alert("当前页是首页!");
	}else{
	$("#shenhelist").empty();
	pageNumber = pageNumber-1;
	daish(pageNumber);
	}
	$("#daish5").html(pageNumber);
});
$("#daish3").click(function(){
	if(pageNumber==totalPage){
		alert("当前页是尾页!");
	}else{
	$("#shenhelist").empty();
	pageNumber = pageNumber +1;
	daish(pageNumber);
	}
	$("#daish5").html(pageNumber);
});
$("#daish4").click(function(){
	$("#shenhelist").empty();
	daish(totalPage);
	pageNumber = totalPage;
	$("#daish5").html(pageNumber);
});
function daish(page){
	$.getJSON("/bid/list?status=founding&page="+page+"&size=12", function(shlist) {
		 
		totalPage = shlist.data.page.totalPage;
		$("#daish6").html(totalPage);
		$.each(shlist.data.page.list, function(i, item){ 
			var shenhelist = {name:item.name,create_time:item.create_time,amount:item.amount,id:item.id};
			$("#shenhe").tmpl(shenhelist).appendTo('#shenhelist');
		});
		$(".pass").click(function(){
			var idval = $(this).attr("pass");
			 
			$.getJSON("/bid/check?id="+idval, function(data) {
				if(data.code=='success'){
					layer.msg(data.msg, {icon:1},function(){
						location.href="#(path)/admin/page/target-requireaudit"
					});
				}else if(data.code=='error'){
					layer.msg(data.msg, {icon:2});
				}
			});
		});
	});	
}


</script> 
</body>
</html>

